<<<<<<< HEAD
"""
插值方法：机床加工
"""

import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt

plt.style.use(['science', 'grid', 'muted'])

x0 = np.array([0, 3, 5, 7, 9, 11, 12, 13, 14, 15])
y0 = np.array([0, 1.2, 1.7, 2.0, 2.1, 2.0, 1.8, 1.2, 1.0, 1.6])
x1 = np.linspace(0, 0.1, 15)

plt.figure(figsize=(8, 6))
for method in ["nearest", "zero", "slinear", "quadratic", "cubic"]:  # 插值方式
    f = interpolate.interp1d(x0, y0, kind=method)
    y1 = f(x1)
    plt.plot(x1, y1, label=method)
plt.title('Interpolation')
plt.legend(loc="lower right")
plt.show()
=======
"""
插值方法：机床加工
"""

import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt

plt.style.use(['science', 'grid', 'muted'])

x0 = np.array([0, 3, 5, 7, 9, 11, 12, 13, 14, 15])
y0 = np.array([0, 1.2, 1.7, 2.0, 2.1, 2.0, 1.8, 1.2, 1.0, 1.6])
x1 = np.linspace(0, 0.1, 15)

plt.figure(figsize=(8, 6))
for method in ["nearest", "zero", "slinear", "quadratic", "cubic"]:  # 插值方式
    f = interpolate.interp1d(x0, y0, kind=method)
    y1 = f(x1)
    plt.plot(x1, y1, label=method)
plt.title('Interpolation')
plt.legend(loc="lower right")
plt.show()
>>>>>>> a66c8eec2c3bbe955d7da215f43ffffda9c7b6b5
